﻿using System.ComponentModel.DataAnnotations;
using CID.Domain.Infrastructure;

namespace CID.Web.Models.Infrastructure
{
    public class DeploymentAgentViewModel : BaseNamedViewModel<IDeploymentAgent>
    {
        [Required(ErrorMessage = "An Address must be provided")]
        public string Address { get; set; }
        public bool Enabled { get; set; }

        public DeploymentAgentViewModel() : base() { }

        public DeploymentAgentViewModel(IDeploymentAgent model) : base(model)
        {
            Name = model.Name;
            Address = model.Address;
            Enabled = model.Enabled;
        }

        public override void UpdateModel(IDeploymentAgent model)
        {
            base.UpdateModel(model);
            model.Name = Name;
            model.Address = Address;
            model.Enabled = Enabled;
        }
    }
}